package com.kc.gb.device.common.enums;

import lombok.Data;

public enum ErrorCode {
    SUCCESS("200", "操作成功"),
    LOGIN_ERROR("30001", "登录失败"),
    ILLEGAL_USER("30002", "用户名异常"),
    ILLEGAL_PASSWORD("30003", "密码异常"),
    ILLEGAL_TOKEN("30004", "Token 异常"),
    RESOURCE_CONFLICT("30005", "资源冲突异常"),
    I18N_ERROR("30006", "I18N 配置异常"),

    //系统公共参数 40000-50000
    SYSTEM_ERROR("40000", "系统异常"),
    INTERFACE_ERROR("40001", "权限异常"),
    DATABASE_ERROR("40002", "数据库异常"),
    IO_ERROR("40003", "IO异常"),
    PARAM_ERROR("40004", "参数错误"),

    BIZ_ERROR("60000", "业务异常"),
    //公共业务错误码从60000-99999

    STATION_NOT_FOUND("60010", "未查询到工作站信息"),
    STATION_NOT_BIND("60010", "工作站位未绑定"),
    HARDWARE_NOT_ENABLED("60010", "硬件未启用"),
    HARDWARE_CONNECT_ERROR("60010", "硬件通信异常"),
    PTL_CAN_NOT_OPEN_IN_SIMULATOR("60020", "运行模式异常"),
    ;

    /**
     * 错误码
     */
    private String code;

    /**
     * 错误信息
     */
    private String desc;


    /**
     * 使用错误码和错误信息构造枚举
     *
     * @param code    错误码
     * @param message 错误信息
     */
    ErrorCode(String code, String message) {
        this.code = code;
        this.desc = message != null ? message : "";
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
